/**
 * 
 */
package com.business.commons.baseUtil;

/**
 * 	ArrayUtils.java
 * @author dr.dai
 * date:2014-1-21
 */
public class ArrayUtils {

	
	
	private ArrayUtils(){
	}
	
	
	private static ArrayUtils instance;
	
	public static ArrayUtils get() {
		if(instance == null ){
			instance = new ArrayUtils(); 
		}
		return instance;
	}

	public  int[] toIntValues(Integer [] arrays){
		int [] newArr = new int[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = arrays[i].intValue();
		}
		return newArr;
	}
	
	public  long[] toLongValues(Long [] arrays){
		long [] newArr = new long[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = arrays[i].intValue();
		}
		return newArr;
	}
	

	public  double[] toDoubleValues(Double [] arrays){
		double [] newArr = new double[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = arrays[i].intValue();
		}
		return newArr;
	}
	
	public  float[] toFloatValues(Float [] arrays){
		float [] newArr = new float[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = arrays[i].intValue();
		}
		return newArr;
	}
	
	
	public  Integer[] toIntegerObjs(int [] arrays){
		Integer [] newArr = new Integer[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = Integer.valueOf(arrays[i]);;
		}
		return newArr;
	}
	
	public  Double[] toDoubleObjs(double [] arrays){
		Double [] newArr = new Double[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = Double.valueOf(arrays[i]);;
		}
		return newArr;
	}
	
	public  Float[] toFloatObjs(float [] arrays){
		Float [] newArr = new Float[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = Float.valueOf(arrays[i]);;
		}
		return newArr;
	}
	
	
	public  Long[] toLongObjs(long [] arrays){
		Long [] newArr = new Long[arrays.length];
		
		for(int i=0;i<arrays.length;i++){
			newArr[i] = Long.valueOf(arrays[i]);;
		}
		return newArr;
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ArrayUtils.get().toDoubleObjs(new double[]{1d,2d});
	}

}
